﻿using Microsoft.AspNetCore.Mvc.Filters;

namespace SC.GridManage.MN.API.Write
{
    public class MnExceptionFilter : IExceptionFilter
    {
        private readonly ILogger<MnExceptionFilter> logger;

        public MnExceptionFilter(ILogger<MnExceptionFilter> logger)
        {
            this.logger = logger;
        }

        public void OnException(ExceptionContext context)
        {
            logger.LogError("有全局错误"+context.Exception.Message);
            context.ExceptionHandled = true;
            
        }
    }
}
